package cn.iocoder.yudao.module.pm.dal.mysql.retentionledger;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pm.controller.admin.retentionledger.vo.RetentionLedgerPageReqVO;
import cn.iocoder.yudao.module.pm.dal.dataobject.retentionledger.RetentionLedgerDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 留样台账管理 Mapper
 *
 * @author yisl
 */
@Mapper
public interface RetentionLedgerMapper extends BaseMapperX<RetentionLedgerDO> {

    default PageResult<RetentionLedgerDO> selectPage(RetentionLedgerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RetentionLedgerDO>()
                .eqIfPresent(RetentionLedgerDO::getLedgerCode, reqVO.getLedgerCode())
                .eqIfPresent(RetentionLedgerDO::getFlightNo, reqVO.getFlightNo())
                .geIfPresent(RetentionLedgerDO::getStartDate, reqVO.getStartDate())
                .leIfPresent(RetentionLedgerDO::getEndDate, reqVO.getEndDate())
                .betweenIfPresent(RetentionLedgerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RetentionLedgerDO::getId));
    }

}